package com.dongdong.android.framework.download;

import android.text.TextUtils;

public class FileInfo {

    /**
     * 文件名称
     */
    private String name;

    /**
     * 下载地址
     */
    private String url;

    /**
     * 长度或结束位置
     */
    private long length = DownloadManager.TOTAL_ERROR;

    /**
     * 开始位置
     */
    private long start = 0L;

    /**
     * 当前进度
     */
    private int progress = 0;

    private String localPath;

    private StatusMode status;

    public String getName() {
        if (TextUtils.isEmpty(name)) {
            if (url.lastIndexOf("/") + 1 < url.length()) {
                String formurl = url.substring(url.lastIndexOf("/") + 1);
                return formurl;
            }

        }
        return name;

    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public long getLength() {
        return length;
    }

    public void setLength(long length) {
        this.length = length;
    }

    public long getStart() {
        return start;
    }

    public void setStart(long start) {
        this.start = start;
    }

    public int getProgress() {
        return progress;
    }

    public void setProgress(int progress) {
        this.progress = progress;
    }

    public StatusMode getStatus() {
        return status;
    }

    public void setStatus(StatusMode status) {
        this.status = status;
    }

    public String getLocalPath() {
        return localPath;
    }

    public void setLocalPath(String localPath) {
        this.localPath = localPath;
    }
}
